package cn.szzsi._webpc;

import cn.szzsi._web.BaseWebController;
import cn.szzsi.common.bean.dto.Msg;
import cn.szzsi.common.kit.BackUtil;
import cn.szzsi.common.model.Member;
import cn.szzsi.common.model.TocashBank;

import java.util.HashMap;
import java.util.Map;

/**
 * 提现银行卡管理
 * Created by yuanzheng on 2016/11/29.
 */
public class CashingBankController extends BaseWebPcController<TocashBank>{

    public void index(){
        Member member=getLoginMember();//当前登录用户
        TocashBank tocashBank=TocashBank.getByMemberId(member.getId());
        setAttr("tocashBank",tocashBank);
        pcTemplatePath("member_account.html");
    }

    public void save(){
        Member member=getLoginMember();//当前登录用户
        String name=getPara("name");//提现人姓名
        String cardNumber=getPara("cardNumber");//换行卡号
        String cardCount=getPara("cardCount");//开户行名称
        String cardAddress=getPara("cardAddress");//开户行地址
        String idNumber=getPara("idNumber");//身份证号
        String aliPayAccount=getPara("aliPayAccount");//支付宝账号
        String weChatAccount=getPara("weChatAccount");
        TocashBank.saveCashingBank(member.getStr("id"),name,cardNumber,cardCount,cardAddress,idNumber,aliPayAccount,weChatAccount);
        renderJson(BackUtil.success("操作成功!"));
    }

    public void delete(){
        Integer id=getParaToInt("id");
        TocashBank toCashingBank= TocashBank.dao.findById(id);
        toCashingBank.delete();
        renderJson(BackUtil.success());
    }
}
